package com.coocaa.ops.admin.v1.panel.biz.impl;

import com.coocaa.ops.admin.v1.panel.biz.IBlockExtendPosterInfoBiz;
import com.coocaa.ops.admin.v1.panel.mapper.IBlockExtendPosterInfoMapper;
import com.coocaa.ops.common.core.base.BaseBizImpl;
import com.coocaa.ops.common.core.biz.panel.entity.BlockContentInfoEntity;
import com.coocaa.ops.common.core.biz.panel.entity.BlockExtendPosterInfoEntity;
import com.coocaa.ops.common.tool.base.InstanceUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author bjh
 * @description 推荐位背景图配置表-biz层接口实现
 * @date 2021-02-22 10:12:14
 */
@Service
public class BlockExtendPosterInfoBizImpl extends BaseBizImpl<IBlockExtendPosterInfoMapper, BlockExtendPosterInfoEntity> implements IBlockExtendPosterInfoBiz {
    @Override
    public void handleSaveBlockExtendPoster(List<BlockContentInfoEntity> blockContentInfoEntityList) {
        List<BlockExtendPosterInfoEntity> blockExtendPosterInfoEntityList = InstanceUtil.newArrayList();
        for (BlockContentInfoEntity contentInfoEntity : blockContentInfoEntityList) {
            BlockExtendPosterInfoEntity blockExtendPosterInfoEntity = contentInfoEntity.getExtendPosterInfo();
            if (null != blockExtendPosterInfoEntity) {
                blockExtendPosterInfoEntity.setBlockId(contentInfoEntity.getId());
                blockExtendPosterInfoEntityList.add(blockExtendPosterInfoEntity);
            }
        }
        saveBatchAvoidEmpty(blockExtendPosterInfoEntityList);
    }
}
